/**
 * 城市 -> 地图初始区域
 * 对应 react-native-maps 的 region
 */
export const CITY_REGIONS = {
  乌鲁木齐: {
    latitude: 43.8256,
    longitude: 87.6168,
    latitudeDelta: 0.02,
    longitudeDelta: 0.02,
  },
  乌鲁木齐市: {
    latitude: 43.8256,
    longitude: 87.6168,
    latitudeDelta: 0.02,
    longitudeDelta: 0.02,
  },
};

export function getCityMapRegion(city) {
  if (!city || typeof city !== 'string') {
    return CITY_REGIONS['乌鲁木齐'];
  }

  const trimmedCity = city.trim();
  const normalizedCity = trimmedCity.replace(/市$/u, '');

  return (
    CITY_REGIONS[trimmedCity] ||
    CITY_REGIONS[normalizedCity] ||
    CITY_REGIONS['乌鲁木齐']
  );
}
